home *** CD-ROM | disk | FTP | other *** search
/ C++ für Kids / C++ for kids.iso / Buch / Hallo6x.cpp < prev    next >
C/C++ Source or Header  |  1998-12-28  |  2KB  |  76 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "Hallo6x.h"
  6. //---------------------------------------------------------------------------
  7. #pragma resource "*.dfm"
  8. TForm1 *Form1;
  9. char *Diagnose;
  10. char *Titel;
  11. bool Wahl[3];
  12. String Bereich[3];
  13.  
  14. //---------------------------------------------------------------------------
  15. __fastcall TForm1::TForm1(TComponent* Owner)
  16.     : TForm(Owner)
  17. {
  18. }
  19. //---------------------------------------------------------------------------
  20. void __fastcall TForm1::RadioGroup1Click(TObject *Sender)
  21. {
  22.   switch (RadioGroup1->ItemIndex)
  23.   {
  24.     case 0:
  25.       Diagnose = "Das ist ja toll!";
  26.       break;
  27.     case 1:
  28.       Diagnose ="Das freut mich!";
  29.       break;
  30.     case 2:
  31.       Diagnose ="Das geht ja noch!";
  32.       break;
  33.     case 3:
  34.       Diagnose ="Das tut mir leid!";
  35.       break;
  36.     case 4:
  37.       Diagnose ="Das ist ja schlimm!";
  38.       break;
  39.     case 5:
  40.       Diagnose ="Wenn du meinst...";
  41.   }
  42. }
  43. //---------------------------------------------------------------------------
  44. void __fastcall TForm1::Button1Click(TObject *Sender)
  45. {
  46.   String Text = "Diagnose";
  47.   for (int i=0; i<3; i++)
  48.     if (Wahl[i]) Text = Text + Bereich[i];
  49.   Titel =  Text.c_str();
  50.   Application->MessageBox (Diagnose, Titel, 4+64);
  51. }
  52. //---------------------------------------------------------------------------
  53. void __fastcall TForm1::FormCreate(TObject *Sender)
  54. {
  55.    Bereich[0] = " fⁿr Seele ";
  56.    Bereich[1] = " fⁿr Geist ";
  57.    Bereich[2] = " fⁿr K÷rper ";
  58.    for (int i=0; i<3; Wahl[i++] = false);
  59. }
  60. //---------------------------------------------------------------------------
  61. void __fastcall TForm1::CheckBox1Click(TObject *Sender)
  62. {
  63.   Wahl[0] = CheckBox1->Checked;
  64. }
  65. //---------------------------------------------------------------------------
  66. void __fastcall TForm1::CheckBox2Click(TObject *Sender)
  67. {
  68.   Wahl[1] = CheckBox2->Checked;
  69. }
  70. //---------------------------------------------------------------------------
  71. void __fastcall TForm1::CheckBox3Click(TObject *Sender)
  72. {
  73.   Wahl[2] = CheckBox3->Checked;
  74. }
  75. //---------------------------------------------------------------------------
  76.